﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using OgilvyOne.UKNow.BLL;
using OgilvyOne.UKNow.Mobile.Utilities;

namespace OgilvyOne.UKNow.Mobile.APIs.Events
{
    public class CheckUp : IHttpHandler
    {
        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            var userid = context.Request.QueryString["uid"];
            var eventid = context.Request.QueryString["eventid"];
            int uid = 0;
            int eid = 0;
            if (int.TryParse(userid, out uid))
            {

            }
            if (int.TryParse(eventid, out eid))
            {

            }
            if (uid > 0 && eid > 0)
            {
                var result = new EventsBLL(2052).CheckUserUp(uid, eid);
                context.Response.Write(ResultUtility.ReturnResultJson("0", "{" + String.Format("\"flag\":\"{0}\"", result) + "}", result?"已赞过":"未赞过"));
            }
            else
            {
                context.Response.Write(ResultUtility.ReturnResultJson("-601", "", "参数错误"));
            }

        }
    }
}
